package top.hzy520.email.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import top.hzy520.common.constants.Constants;
import top.hzy520.common.resp.APIResult;
import top.hzy520.email.service.EmailService;

/**
 * @Author: HouZeYu
 * @Description: 邮箱接口
 * @Date: Created in 20:40 2018/5/29
 */
@RequestMapping("/email")
@RestController
public class EmailController {

     @Autowired
     @Qualifier("eamilServiceImpl")
     private EmailService emailService;
     /**
     *@Author: HouZeYu
     *@Description: 发送邮箱验证码
     *@Date: 17:21 2018/6/2
     */
     @RequestMapping("/code")
     public APIResult sendEmail(String email){
         emailService.sendMail(email);
         return new APIResult("邮箱发送成功",Constants.RESP_STATUS_OK);
     }
     /**
     *@Author: HouZeYu
     *@Description: 验证邮箱验证码
     *@Date: 17:22 2018/6/2
     */
     @RequestMapping("/verify")
     public boolean verifyEmailCode(String email,String code){
         return emailService.verifyEmailCode(email,code);
     }
}
